<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>javascript-冒泡排序</title>
</head>
<body>


<script>

    //冒泡排序
    var s =[2,35,100,9,56,12];
    for(var i=0;i< s.length ;i++){
        for(var j=0; j< s.length - 1; j++){
            if(s[j] > s[j + 1]){
                temp = s[j + 1];
                s[j + 1] =s[j];
                s[j] =temp;
            }

        }
    }
    console.log(s)

</script>

</body>
</html>